#ifndef __REDISCLIENT_H__
#define __REDISCLIENT_H__
#include <memory>
#include "Spark/Net/SocketAddr.h"
#include "RedisResult.h"

class RedisTransaction;
class RedisClient;
using RedisClientPtr = std::shared_ptr<RedisClient>;
using RedisTransactionPtr = std::shared_ptr<RedisTransaction>;

struct RedisLoginInfo
{
    std::string password;
    uint32_t db;
};

class RedisClient
{
  public:
    static RedisClientPtr newRedisClient(const SocketAddr& serverAddr,
                                         size_t numConnection,
                                         const std::string& password);

    virtual void newTransaction() = 0;

    virtual void executeCmdAsync(RedisResultCallback_t resultCallback,
                                 RedisResultCallback_t errorCallback,
                                 const char* command,
                                 ...) = 0;

    virtual ~RedisClient()
    {
    }
};

class RedisTransaction
{
  public:
    virtual void execute(RedisResultCallback_t resultCallback,
                         RedisResultCallback_t errorCallback) = 0;
};

#endif  // __REDISCLIENT_H__